<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>表单域修饰符</title>
  </head>
  <body>
    <pre>
        表单域修饰符：就是对表单域输入值进行格式化
        number  v-model.number 数据改为number
        trim  v-model.trim  去除数据二端空格
        lazy  v-model.lazy input失去焦点时同步v-model  把input属性转为change属性
        change  v-on:change input失去焦点时触发事件

        <!-- 注意 -->
        v-model.number.trim 
        v-model.number
      </pre>
    <div class="box">
      <form action="">
        <label for="user">
          用户名：
          <input type="text" v-model.number.trim="usr" id="user" />
        </label>
        <label for="pwd">
          密码:
          <input type="text" v-model.lazy="lazy" id="pwd" />
        </label>
        <p>{{lazy}}</p>
        <button @click.prevent="push">单击</button>
      </form>
    </div>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script>
      new Vue({
        el: '.box',
        data: {
          usr: '',
          lazy: '',
        },
        methods: {
          push() {
            console.log(this.usr)
          },
        },
      })
    </script>
  </body>
</html>
